Skip to content

feat(examples): add code-reviewer quickstart#1

Draft
vadim-rl wants to merge 1 commit into
masterfrom
demo/add-code-reviewer-quickstart-2
Draft

feat(examples): add code-reviewer quickstart#1
vadim-rl wants to merge 1 commit into
masterfrom
demo/add-code-reviewer-quickstart-2

Conversation

@vadim-rl
Copy link
Copy Markdown

@vadim-rl vadim-rl commented Jun 4, 2026

Summary

Add a new code-reviewer/ quickstart example that follows the same structure and conventions as the existing deep_research/ example. This gives users a ready-to-run agent for analyzing source code correctness, style, and security.

What's included

  • code_reviewer/tools.py — Three custom deepagent tools:

    • analyze_code: AST-based static analysis (syntax, naming conventions, docstrings, function complexity, line length)
    • security_audit: Regex-based security scanner (eval/exec, pickle, SQL injection, shell injection, hardcoded secrets, unsafe yaml.load)
    • think_tool: Strategic reflection pattern (same as deep_research)
  • code_reviewer/prompts.py — Three instruction sets mirroring the deep_research structure:

    • REVIEW_WORKFLOW_INSTRUCTIONS: 6-step review workflow
    • REVIEWER_INSTRUCTIONS: Sub-agent instructions with hard limits
    • SUBAGENT_DELEGATION_INSTRUCTIONS: Parallelization strategy
  • agent.py — Standalone LangGraph agent definition with sub-agent support

  • README.md — Self-contained with setup (uv sync), two usage options (direct Python invocation + LangGraph server), custom model/instructions/tools sections with tables

  • pyproject.toml, langgraph.json, .env.example — following existing patterns

  • Updated examples/README.md to list the new example

How to run

cd examples/code-reviewer
uv sync
export ANTHROPIC_API_KEY=your_key_here

Then either run via LangGraph server (langgraph dev) or use the direct Python invocation from the README.

Review notes

  • All patterns (file structure, import style, docstring format, README layout, tool registration) follow the deep_research/ example exactly
  • No existing files were modified except examples/README.md
  • The tools use only Python standard library (ast, re) — no additional external dependencies beyond the deepagents stack
  • Verified with unit testing: all tools produce correct output for edge cases (empty code, syntax errors, clean code, mixed security patterns)

This contribution was developed with the assistance of AI agents to generate code following existing project conventions.

Add a new code-reviewer quickstart that demonstrates building a code
review agent using the deepagents package. The agent analyzes source
code for correctness, style, and security using:

- analyze_code: AST-based static analysis for naming conventions,
  missing docstrings, function complexity, and style violations
- security_audit: Pattern-matching security scanner for eval/exec,
  pickle, SQL injection, shell injection, and hardcoded secrets
- think_tool: Strategic reflection mechanism for quality assessment

Includes a self-contained README with setup instructions and a
copy-paste Python invocation example, pyproject.toml, langgraph.json,
.env.example, and the full package structure following existing
deep_research conventions.

Updated examples/README.md to list the new quickstart.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant